<?php
	 header("Content-type: text/html; charset=utf-8"); 
	$key="FUQBZ-MBXWS-KRLOF-6CUUC-3U2XS-Q2BMF";
	$from=$_GET['from'];
	$to=$_GET['to'];
	$url='https://apis.map.qq.com/ws/direction/v1/walking/?from='.$from.'&to='.$to.'&key='.$key;
	// ?from=39.957962,116.803665&to=39.952755,116.804280&key=FUQBZ-MBXWS-KRLOF-6CUUC-3U2XS-Q2BMF
	// echo $url;
	//https://apis.map.qq.com/ws/direction/v1/walking/?from=39.984042,116.307535&to=39.976249,116.316569&key=FUQBZ-MBXWS-KRLOF-6CUUC-3U2XS-Q2BMF
	$info = file_get_contents($url);//发送HTTPs请求并获取返回的数据，推荐使用curl
	$json = json_decode($info);//对json数据解码 
	$arr = get_object_vars($json);
	// $distance=$arr["result"];
	// $distance = get_object_vars($distance);
	
	echo json_encode($arr);
	// echo $distance;
?>